unit uBillPrintSetting;

interface

uses
  WinApi.Windows, WinApi.Messages, SysUtils, Variants, Classes, Graphics,
  Controls, Forms, Dialogs, uniGUITypes, uniGUIAbstractClasses,
  uniGUIClasses, uniGUIForm, uniGUIBaseClasses, uniRadioGroup, uniCheckBox,
  uniPanel, uniButton, uniBitBtn;

type
  TDoPrintBill = procedure (billNo: string) of object;
  TFrmBillPrintSetting = class(TUniForm)
    UniPanel1: TUniPanel;
    chkMainDoc: TUniCheckBox;
    chkSubDoc: TUniCheckBox;
    UniPanel2: TUniPanel;
    btSave: TUniBitBtn;
    btClose: TUniBitBtn;
    procedure btCloseClick(Sender: TObject);
    procedure btSaveClick(Sender: TObject);
    procedure chkMainDocClick(Sender: TObject);
    procedure chkSubDocClick(Sender: TObject);
    procedure UniFormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    pbillNo: string;
    printMainEvent, printSubEvent: TDoPrintBill;
  end;

function FrmBillPrintSetting: TFrmBillPrintSetting;

implementation

{$R *.dfm}

uses
  MainModule, uniGUIApplication, uCommFunction;

function FrmBillPrintSetting: TFrmBillPrintSetting;
begin
  Result := TFrmBillPrintSetting(UniMainModule.GetFormInstance(TFrmBillPrintSetting));
end;

procedure TFrmBillPrintSetting.btCloseClick(Sender: TObject);
begin
  Close;
end;

procedure TFrmBillPrintSetting.btSaveClick(Sender: TObject);
begin
  if chkMainDoc.Checked then
    printMainEvent(pbillNo)
  else
    printSubEvent(pbillNo);
end;


procedure TFrmBillPrintSetting.chkMainDocClick(Sender: TObject);
begin
  chkSubDoc.Checked := not chkMainDoc.Checked;
end;

procedure TFrmBillPrintSetting.chkSubDocClick(Sender: TObject);
begin
  chkMainDoc.Checked := not chkSubDoc.Checked;
end;

procedure TFrmBillPrintSetting.UniFormCreate(Sender: TObject);
begin
  SetCompoentLanguage(Self);
end;

end.
